import type { ArtColumn } from 'ali-react-table';
import { Button, Divider } from 'antd';

type ColumnsOptionsType = {
  edit: (row: any) => void;
  del: (row: any) => void;
};

const getColumns = ({ edit, del }: ColumnsOptionsType): ArtColumn[] => {
  return [
    {
      name: '交易中心',
      align: 'center',
      code: 'marketName',
    },
    {
      name: '文件类别',
      align: 'center',
      code: 'description',
    },
    {
      name: '操作',
      code: 'options',
      align: 'center',
      render: (value, row) => {
        return (
          <div className="btns">
            <Button type="link" onClick={() => edit(row)} disabled={row.loginStatus === '1'}>
              编辑
            </Button>
            <Divider type="vertical" />
            <Button type="link" onClick={() => del(row)} disabled={row.loginStatus === '1'}>
              删除
            </Button>
          </div>
        );
      },
    },
  ];
};

export { getColumns };
